namespace pos.entity
{
using System;
using System.Data;
using System.Configuration;
using System.Text;
using System.Data.OleDb;
using System.Collections;
using System.Windows.Forms;
using NHibernate;
using NHibernate.Criterion;
/// <summary>
/// t_users 的摘要说明
/// </summary>
public class t_users:IEntityUtil
{
//   状态值的哈希表 
	private static Hashtable m_enum_userState;
	public static Hashtable  enum_userState
	{
		get{return m_enum_userState;}
	}
	public const int USEROK=100;
	public const int USERSTOP=101;
//   用户类型值的哈希表 
	private static Hashtable m_enum_userType;
	public static Hashtable  enum_userType
	{
		get{return m_enum_userType;}
	}
	public const int NORMAL=200;
	public const int SUPPER=201;
	//   列名称哈希表 
	private static Hashtable m_colLabels;    	 
	public static Hashtable colLabels//
	{
		get{return m_colLabels;}
	}
	//表字段名称哈希表
	private static ArrayList m_colNames;     
	public static ArrayList  colNames　
	{
		get{return m_colNames;}
	}
	private Users __users;
	public long seqID  
	{
		get{return __users.seqID;}
		set{ __users.seqID=value;}
	}
	public String userID  
	{
		get{return __users.userID;}
		set{ __users.userID=value;}
	}
	public String userName  
	{
		get{return __users.userName;}
		set{ __users.userName=value;}
	}
	public String userPassword  
	{
		get{return __users.userPassword;}
		set{ __users.userPassword=value;}
	}
	public String groupID  
	{
		get{return __users.groupID;}
		set{ __users.groupID=value;}
	}
	public int userState  
	{
		get{return __users.userState;}
		set{ __users.userState=value;}
	}
	public String userRealName  
	{
		get{return __users.userRealName;}
		set{ __users.userRealName=value;}
	}
	public String userRemark  
	{
		get{return __users.userRemark;}
		set{ __users.userRemark=value;}
	}
	public String userTel  
	{
		get{return __users.userTel;}
		set{ __users.userTel=value;}
	}
	public int userType  
	{
		get{return __users.userType;}
		set{ __users.userType=value;}
	}
	private static  UsersDao dao=(UsersDao)SpringContext.Context.GetObject("UsersDao");
	public static UsersDao DAO
	{
		get{return dao;}
		
	}
	
	public t_users()
	{
		__users=new Users();
	  	seqID=consts.long_min;
	  	userID="";
	  	userName="";
	  	userPassword="";
	  	groupID="";
	  	userState=consts.int_min;
	  	userRealName="";
	  	userRemark="";
	  	userTel="";
	  	userType=consts.int_min;
	  // dao=(UsersDao)SpringContext.Context.GetObject("UsersDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("seqID", @"序号标识");
		colNames.Add("seqID");
		m_colLabels.Add("userID", @"用户编号");
		colNames.Add("userID");
		m_colLabels.Add("userName", @"用户名");
		colNames.Add("userName");
		m_colLabels.Add("userPassword", @"用户密码");
		colNames.Add("userPassword");
		m_colLabels.Add("groupID", @"组号");
		colNames.Add("groupID");
		m_colLabels.Add("userState", @"状态");
		colNames.Add("userState");
		m_enum_userState= new Hashtable();
		m_enum_userState.Add("100", @"正常");
		m_enum_userState.Add("101", @"停用");
		m_colLabels.Add("userRealName", @"真实姓名");
		colNames.Add("userRealName");
		m_colLabels.Add("userRemark", @"备注");
		colNames.Add("userRemark");
		m_colLabels.Add("userTel", @"联系电话");
		colNames.Add("userTel");
		m_colLabels.Add("userType", @"用户类型");
		colNames.Add("userType");
		m_enum_userType= new Hashtable();
		m_enum_userType.Add("200", @"普通用户");
		m_enum_userType.Add("201", @"超级用户");
	  }
	
	}
	public t_users(Users entity )
	{
		__users=entity;
		
	  // dao=(UsersDao)SpringContext.Context.GetObject("UsersDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("seqID", @"序号标识");
		colNames.Add("seqID");
		m_colLabels.Add("userID", @"用户编号");
		colNames.Add("userID");
		m_colLabels.Add("userName", @"用户名");
		colNames.Add("userName");
		m_colLabels.Add("userPassword", @"用户密码");
		colNames.Add("userPassword");
		m_colLabels.Add("groupID", @"组号");
		colNames.Add("groupID");
		m_colLabels.Add("userState", @"状态");
		colNames.Add("userState");
		m_enum_userState= new Hashtable();
		m_enum_userState.Add("100", @"正常");
		m_enum_userState.Add("101", @"停用");
		m_colLabels.Add("userRealName", @"真实姓名");
		colNames.Add("userRealName");
		m_colLabels.Add("userRemark", @"备注");
		colNames.Add("userRemark");
		m_colLabels.Add("userTel", @"联系电话");
		colNames.Add("userTel");
		m_colLabels.Add("userType", @"用户类型");
		colNames.Add("userType");
		m_enum_userType= new Hashtable();
		m_enum_userType.Add("200", @"普通用户");
		m_enum_userType.Add("201", @"超级用户");
	  }
	
	}
	public Object uniqueResult(DetachedCriteria dc)
    {
        return dao.uniqueResult(dc);
    }
	 public DetachedCriteria DC 
     {
        	get{return DetachedCriteria.For(typeof(Users));}
     }
	public const string ENTITYNAME="t_users";
	public const int SEQN0=50;
	
    public void checkAdd()
    {
		int len;
	//try{Convert.ToInt64(seqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	seqID<consts.long_min+1)
			throw (new Exception("请输入序号标识"));
 if(				(				  string.Format("{0}",seqID)				  )=="0")
	 throw (new Exception("序号标识是主健，框架要求值不能为0"));				

	
	len=userID.Trim().Length;
	if(len>10)
		 throw (new Exception("用户编号字符长度最长不能超过10,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("用户编号不能为空!"));	
	

	
	len=userName.Trim().Length;
	if(len>20)
		 throw (new Exception("用户名字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("用户名不能为空!"));	
	

	
	len=userPassword.Trim().Length;
	if(len>20)
		 throw (new Exception("用户密码字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("用户密码不能为空!"));	
	

	
	len=groupID.Trim().Length;
	if(len>10)
		 throw (new Exception("组号字符长度最长不能超过10,当前长度为"+len.ToString()));	
	

	//try{Convert.ToInt32(userState);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	userState<consts.int_min+1)
			throw (new Exception("请输入状态"));

	
	len=userRealName.Trim().Length;
	if(len>10)
		 throw (new Exception("真实姓名字符长度最长不能超过10,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("真实姓名不能为空!"));	
	

	
	len=userRemark.Trim().Length;
	if(len>50)
		 throw (new Exception("备注字符长度最长不能超过50,当前长度为"+len.ToString()));	
	

	
	len=userTel.Trim().Length;
	if(len>29)
		 throw (new Exception("联系电话字符长度最长不能超过29,当前长度为"+len.ToString()));	
	

	//try{Convert.ToInt32(userType);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	userType<consts.int_min+1)
			throw (new Exception("请输入用户类型"));

//unique="yes" 唯一性验证
		ICriterion crit=Restrictions.Eq("userID", userID);
		crit=Restrictions.Or(crit,Restrictions.Eq("userName", userName));
  		IList list=dao.List(dao.DC.Add(crit));
		if(list.Count==0)
			return;
		Users obj=list[0] as Users;
//唯一性异常消息抛出
		if( obj.userID==userID)
		{
			throw (new Exception(string.Format("用户编号:{0}已经存在",userID)));	
		}
		if( obj.userName==userName)
		{
			throw (new Exception(string.Format("用户名:{0}已经存在",userName)));	
		}
	//end unique="yes" 唯一性验证
    }
    public void checkUpdate()
    {
		int len;
	//try{Convert.ToInt64(seqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	seqID<consts.long_min+1)
			throw (new Exception("请输入序号标识"));
 if(				(				  string.Format("{0}",seqID)				  )=="0")
	 throw (new Exception("序号标识是主健，框架要求值不能为0"));				

	
	len=userID.Trim().Length;
	if(len>10)
		 throw (new Exception("用户编号字符长度最长不能超过10,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("用户编号不能为空!"));	
	

	
	len=userName.Trim().Length;
	if(len>20)
		 throw (new Exception("用户名字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("用户名不能为空!"));	
	

	
	len=userPassword.Trim().Length;
	if(len>20)
		 throw (new Exception("用户密码字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("用户密码不能为空!"));	
	

	
	len=groupID.Trim().Length;
	if(len>10)
		 throw (new Exception("组号字符长度最长不能超过10,当前长度为"+len.ToString()));	
	

	//try{Convert.ToInt32(userState);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	userState<consts.int_min+1)
			throw (new Exception("请输入状态"));

	
	len=userRealName.Trim().Length;
	if(len>10)
		 throw (new Exception("真实姓名字符长度最长不能超过10,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("真实姓名不能为空!"));	
	

	
	len=userRemark.Trim().Length;
	if(len>50)
		 throw (new Exception("备注字符长度最长不能超过50,当前长度为"+len.ToString()));	
	

	
	len=userTel.Trim().Length;
	if(len>29)
		 throw (new Exception("联系电话字符长度最长不能超过29,当前长度为"+len.ToString()));	
	

	//try{Convert.ToInt32(userType);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	userType<consts.int_min+1)
			throw (new Exception("请输入用户类型"));

//unique="yes" 唯一性验证
		ICriterion crit=Restrictions.Eq("seqID", seqID);
		crit=Restrictions.Or(crit,Restrictions.Eq("userID", userID));
		crit=Restrictions.Or(crit,Restrictions.Eq("userName", userName));
  		IList list=dao.List(dao.DC.Add(crit));
		if(list.Count==1)
			return;
		if(list.Count==0)
			throw (new Exception("该记录已经被删除"));	
		else
			throw (new Exception("改纪录出现重名!"));
    }
    public void add()
    {
        try
        {
            checkAdd();
         	dao.Add(__users);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void delByseqID()
    {
    
        try
        {
          dao.Delete(__users);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }

    public  void update()
    {
        try
        {
            checkUpdate();
            dao.Update(__users);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void ExecDataUpdate(int rowNo)
    {
		if(m_updateRow==null)
			return;
		int ii=0;
m_updateRow(rowNo,ii++,				(				  string.Format("{0}",seqID)				  ));	
m_updateRow(rowNo,ii++,userID);	
m_updateRow(rowNo,ii++,userName);	
m_updateRow(rowNo,ii++,groupID);	
m_updateRow(rowNo,ii++,	t_users.enum_userState[userState.ToString()].ToString()
);	
m_updateRow(rowNo,ii++,userRealName);	
m_updateRow(rowNo,ii++,userRemark);	
m_updateRow(rowNo,ii++,userTel);	
m_updateRow(rowNo,ii++,	t_users.enum_userType[userType.ToString()].ToString()
);	

    }
    public void ExecHeadInsert()
    {
		if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,50,"序号标识");
			m_insertHead(ii++,60,"用户编号");
			m_insertHead(ii++,100,"用户名");
			m_insertHead(ii++,60,"组号");
			m_insertHead(ii++,60,"状态");
			m_insertHead(ii++,60,"真实姓名");
			m_insertHead(ii++,60,"备注");
			m_insertHead(ii++,60,"联系电话");
			m_insertHead(ii++,80,"用户类型");
		}		
    }
    public void ExecDataInsert()
	{
		if(m_insertRow==null)
			return;
		int ii=0;
     	m_insertRow(0,ii++,				(				  string.Format("{0}",seqID)				  ));
     	m_insertRow(0,ii++,userID);
     	m_insertRow(0,ii++,userName);
     	m_insertRow(0,ii++,groupID);
     	m_insertRow(0,ii++,	t_users.enum_userState[userState.ToString()].ToString()
);
     	m_insertRow(0,ii++,userRealName);
     	m_insertRow(0,ii++,userRemark);
     	m_insertRow(0,ii++,userTel);
     	m_insertRow(0,ii++,	t_users.enum_userType[userType.ToString()].ToString()
);
    }
    public void ExecDataInsertByQuery(DetachedCriteria dc)
    {
      
         IList list=dao.List(dc); 
        
        if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,50,"序号标识");
			m_insertHead(ii++,60,"用户编号");
			m_insertHead(ii++,100,"用户名");
			m_insertHead(ii++,60,"组号");
			m_insertHead(ii++,60,"状态");
			m_insertHead(ii++,60,"真实姓名");
			m_insertHead(ii++,60,"备注");
			m_insertHead(ii++,60,"联系电话");
			m_insertHead(ii++,80,"用户类型");
		}		
		
      if(m_insertRow!=null)
      {
        int j=0;
        foreach(Users obj in list)			
        {
		  int ii=0;
	     
m_insertRow(j,ii++,				(				  string.Format("{0}",obj.seqID)
				  )
);
m_insertRow(j,ii++,obj.userID.ToString());
m_insertRow(j,ii++,obj.userName.ToString());
m_insertRow(j,ii++,obj.groupID.ToString());
m_insertRow(j,ii++,	t_users.enum_userState[obj.userState.ToString()].ToString()
);
m_insertRow(j,ii++,obj.userRealName.ToString());
m_insertRow(j,ii++,obj.userRemark.ToString());
m_insertRow(j,ii++,obj.userTel.ToString());
m_insertRow(j,ii++,	t_users.enum_userType[obj.userType.ToString()].ToString()
);
		j++;
        }
        

	
       }
    }

    
    public IList List(DetachedCriteria dc)
    {
        try
        {
           
            return dao.List(dc);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
    
    public bool Init(DetachedCriteria dc)
    {
    
    		Users obj=dao.Get(dc);
    		if(obj==null)
    			return false;
    		else
    		{
    			__users=obj;
            	return true;
            }
        
    }
    public static t_users Get(DetachedCriteria dc)
    {
    	
    	Users obj=((UsersDao)SpringContext.Context.GetObject("UsersDao"))
	 	.Get(dc);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_users( obj );
        
    }
	 public static t_users GetBySeqID(long val)
	 {
	 	Users obj=((UsersDao)SpringContext.Context.GetObject("UsersDao"))
	 	.GetBySeqID(val);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_users( obj );
	 	
	 	
	 }
	 public  bool InitBySeqID(long val)
	 {
	 	

	 	Users obj=dao.GetBySeqID(val) ;
	 	if(obj==null)
	 		return false;
	 	else
	 	{
	 		__users=obj;
	 		return true;
	 	}
	 	
	 	
	 }
	 public static t_users GetByUserID(String val)
	 {
	 	Users obj=((UsersDao)SpringContext.Context.GetObject("UsersDao"))
	 	.GetByUserID(val);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_users( obj );
	 	
	 	
	 }
	 public  bool InitByUserID(String val)
	 {
	 	

	 	Users obj=dao.GetByUserID(val) ;
	 	if(obj==null)
	 		return false;
	 	else
	 	{
	 		__users=obj;
	 		return true;
	 	}
	 	
	 	
	 }
	 public static t_users GetByUserName(String val)
	 {
	 	Users obj=((UsersDao)SpringContext.Context.GetObject("UsersDao"))
	 	.GetByUserName(val);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_users( obj );
	 	
	 	
	 }
	 public  bool InitByUserName(String val)
	 {
	 	

	 	Users obj=dao.GetByUserName(val) ;
	 	if(obj==null)
	 		return false;
	 	else
	 	{
	 		__users=obj;
	 		return true;
	 	}
	 	
	 	
	 }
    
       public bool showInForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["seqID"]!=null)
		{
			Controls["seqID"].Text=				(				  string.Format("{0}",seqID)				  );
		}
		if(Controls["userID"]!=null)
		{
			Controls["userID"].Text=userID;
		}
		if(Controls["userName"]!=null)
		{
			Controls["userName"].Text=userName;
		}
		if(Controls["userPassword"]!=null)
		{
			Controls["userPassword"].Text=userPassword;
		}
		if(Controls["groupID"]!=null)
		{
			Controls["groupID"].Text=groupID;
		}
		if(Controls["userState"]!=null)
		{
			Controls["userState"].Text=	t_users.enum_userState[userState.ToString()].ToString()
;
		}
		if(Controls["userRealName"]!=null)
		{
			Controls["userRealName"].Text=userRealName;
		}
		if(Controls["userRemark"]!=null)
		{
			Controls["userRemark"].Text=userRemark;
		}
		if(Controls["userTel"]!=null)
		{
			Controls["userTel"].Text=userTel;
		}
		if(Controls["userType"]!=null)
		{
			Controls["userType"].Text=	t_users.enum_userType[userType.ToString()].ToString()
;
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    public  t_users Init(Users item)
    {
        __users=item;
        return this;
    }

    
     public bool initByForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["seqID"]!=null)
		{
			
			if(Controls["seqID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["seqID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{seqID=(v==""?consts.long_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["seqID"].Focus();
					throw  (new Exception("序号标识格式不正确！！"));
				}
				
			}
			else
			{
				try{seqID=(Controls["seqID"].Text==""?consts.long_min:Convert.ToInt32(Controls["seqID"].Text));}
				catch
				{
					 Controls["seqID"].Focus();
					throw  (new Exception("序号标识格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userID"]!=null)
		{
			
			if(Controls["userID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userID=v;}
				catch
				{
					 Controls["userID"].Focus();
					throw  (new Exception("用户编号格式不正确！！"));
				}
				
			}
			else
			{
				try{userID=Controls["userID"].Text;}
				catch
				{
					 Controls["userID"].Focus();
					throw  (new Exception("用户编号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userName"]!=null)
		{
			
			if(Controls["userName"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userName"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userName=v;}
				catch
				{
					 Controls["userName"].Focus();
					throw  (new Exception("用户名格式不正确！！"));
				}
				
			}
			else
			{
				try{userName=Controls["userName"].Text;}
				catch
				{
					 Controls["userName"].Focus();
					throw  (new Exception("用户名格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userPassword"]!=null)
		{
			
			if(Controls["userPassword"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userPassword"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userPassword=v;}
				catch
				{
					 Controls["userPassword"].Focus();
					throw  (new Exception("用户密码格式不正确！！"));
				}
				
			}
			else
			{
				try{userPassword=Controls["userPassword"].Text;}
				catch
				{
					 Controls["userPassword"].Focus();
					throw  (new Exception("用户密码格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["groupID"]!=null)
		{
			
			if(Controls["groupID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["groupID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{groupID=v;}
				catch
				{
					 Controls["groupID"].Focus();
					throw  (new Exception("组号格式不正确！！"));
				}
				
			}
			else
			{
				try{groupID=Controls["groupID"].Text;}
				catch
				{
					 Controls["groupID"].Focus();
					throw  (new Exception("组号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userState"]!=null)
		{
			
			if(Controls["userState"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userState"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userState=(v==""?consts.int_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["userState"].Focus();
					throw  (new Exception("状态格式不正确！！"));
				}
				
			}
			else
			{
				try{userState=(Controls["userState"].Text==""?consts.int_min:Convert.ToInt32(Controls["userState"].Text));}
				catch
				{
					 Controls["userState"].Focus();
					throw  (new Exception("状态格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userRealName"]!=null)
		{
			
			if(Controls["userRealName"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userRealName"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userRealName=v;}
				catch
				{
					 Controls["userRealName"].Focus();
					throw  (new Exception("真实姓名格式不正确！！"));
				}
				
			}
			else
			{
				try{userRealName=Controls["userRealName"].Text;}
				catch
				{
					 Controls["userRealName"].Focus();
					throw  (new Exception("真实姓名格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userRemark"]!=null)
		{
			
			if(Controls["userRemark"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userRemark"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userRemark=v;}
				catch
				{
					 Controls["userRemark"].Focus();
					throw  (new Exception("备注格式不正确！！"));
				}
				
			}
			else
			{
				try{userRemark=Controls["userRemark"].Text;}
				catch
				{
					 Controls["userRemark"].Focus();
					throw  (new Exception("备注格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userTel"]!=null)
		{
			
			if(Controls["userTel"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userTel"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userTel=v;}
				catch
				{
					 Controls["userTel"].Focus();
					throw  (new Exception("联系电话格式不正确！！"));
				}
				
			}
			else
			{
				try{userTel=Controls["userTel"].Text;}
				catch
				{
					 Controls["userTel"].Focus();
					throw  (new Exception("联系电话格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userType"]!=null)
		{
			
			if(Controls["userType"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userType"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userType=(v==""?consts.int_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["userType"].Focus();
					throw  (new Exception("用户类型格式不正确！！"));
				}
				
			}
			else
			{
				try{userType=(Controls["userType"].Text==""?consts.int_min:Convert.ToInt32(Controls["userType"].Text));}
				catch
				{
					 Controls["userType"].Focus();
					throw  (new Exception("用户类型格式不正确！！"));
				}
				
			}
				
				
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    

}

}
